package com.sdy.sd;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

/**
 * An example full-screen activity that shows and hides the system UI (i.e.
 * status bar and navigation/system bar) with user interaction.
 */
public class artPixel extends AppCompatActivity implements View.OnClickListener {
    artPixView mV = null;
    Button mBtnLinearRGB = null;
    Button mBtnLinearHSL = null;
    Button mBtnPolar1 = null;
    Button mBtnRose3 = null;
    Button mBtnInvolute = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_art_pixel);

        mV = findViewById(R.id.id_art_pix_view);
        mBtnLinearRGB = findViewById(R.id.btn_art_orthogonal_rgb);
        mBtnLinearRGB.setOnClickListener(this);
        mBtnLinearHSL = findViewById(R.id.btn_linear_hsl);
        mBtnLinearHSL.setOnClickListener(this);
        mBtnPolar1 = findViewById(R.id.btn_polar1);
        mBtnPolar1.setOnClickListener(this);
        mBtnRose3 = findViewById(R.id.btn_rose3);
        mBtnRose3.setOnClickListener(this);
        mBtnInvolute = findViewById(R.id.btn_involute);
        mBtnInvolute.setOnClickListener(this);
    }
    @Override
    protected void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
    }

    private void doOnclick_btn_art_orthogonal_rgb() {
        mV.makeBmp_linear_rgb(mV.getWidth(), mV.getHeight());
        mV.invalidate();
    }
    private void doOnclick_btn_linear_hsl() {
        mV.makeBmp_linear_hsl(mV.getWidth(), mV.getHeight());
        mV.invalidate();
    }
    private void doOnclick_btn_polar1() {
        mV.makeBmp_polar_1(mV.getWidth(), mV.getHeight());
        mV.invalidate();
    }
    private void doOnclick_btn_rose3() {
        mV.makeBmp_rose3(mV.getWidth(), mV.getHeight());
        mV.invalidate();
    }
    private void doOnclick_btn_involute() {
        mV.makeBmp_involute(mV.getWidth(), mV.getHeight());
        mV.invalidate();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_art_orthogonal_rgb: doOnclick_btn_art_orthogonal_rgb(); break;
            case R.id.btn_linear_hsl: doOnclick_btn_linear_hsl(); break;
            case R.id.btn_polar1: doOnclick_btn_polar1(); break;
            case R.id.btn_rose3: doOnclick_btn_rose3(); break;
            case R.id.btn_involute: doOnclick_btn_involute(); break;
            default: break;
        }
    }
}